<%@ page language="java" import="java.util.*,com.hs.hbp.model.*,com.hs.hbp.action.*,com.hs.core.utils.*" pageEncoding="utf-8"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 String searchStr = (String)request.getAttribute("searchStr");
String field = (String)request.getAttribute("field");
String language = (String)request.getAttribute("language"); 
String searchresult = (String)request.getAttribute("searchresult"); 
List datalist = (List)request.getAttribute("list");

String count =  request.getAttribute("count")+"";
String startitem =  request.getAttribute("startitem")+"";

String enditem =  request.getAttribute("enditem")+"";

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<base href="<%=basePath%>">
<title></title>
<script src="<%=basePath %>app/javascripts/jquery-1.5.1.js"></script>
<script src="<%=basePath %>app/javascripts/layout.js"></script>
<script src="<%=basePath %>common/js/common.js"></script>
<script src="<%=basePath %>common/js/check.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath %>app/css/layout.css">
<style>.tac{text-align:center}</style>
<script language=JavaScript type=text/JavaScript>

function searchData()
{
  document.searchform.submit();
}

function searchDetail(rid)
{
  var pageURL = "<%=basePath %>searchDetail.do?rid=" + rid + "&language=en";
     openwindow(pageURL,'800','600',''); 

}

function clearData()
{
  document.searchform.elements["searchStr"].value="";
}
function nextpage(url,searchstr){ 
    window.parent.right.frameElement.src = "<%=basePath %>searchZhuData.do?"+url+"&searchStr="+encodeURIComponent(searchstr);

}
</script>
</head>
<body>
  <div class="cont">
    <form name="searchform" action="<%=basePath %>searchZhuData.do" method="post">
        <div class="sear">
         <%if(datalist.size()>0) {%>
           <p class="right">
                    共有<font color=red><b>${count}</b></font>项符合<b>${searchStr}</b>的查询结果!
            </p><%} %>
            <img src="<%=basePath %>app/images/ico_sear.gif" />
            <input name="searchStr" type="text"  style="width:30%" value="<%=searchStr ==null?"":searchStr%>" class="sear_input" onKeyPress="inputInt();if(event.keyCode==13) searchData()"/>
            <select name="field">
              <option value=""  >--请选择--</option>
              <option value="entitle" <%if("entitle".equals(field)){ out.print(" selected");} %>>标题</option>
              <option value="author" <%if("author".equals(field)){ out.print(" selected");} %>>作者</option>
              <option value="abstract" <%if("abstract".equals(field)){ out.print(" selected");} %>>摘要</option>
              <option value="enthemewords" <%if("enthemewords".equals(field)){ out.print(" selected");} %>>英文主题词</option>
            </select>
            <select name="language">
              <option value="cn" <%if("cn".equals(language)){ out.print(" selected");} %>>CBM</option>
              <option value="en" <%if("en".equals(language)){ out.print(" selected");} %>>PubMed</option>
            </select>
            <input name="" type="button" value="检索" class="butt2" onclick="searchData();"/>
            <!--input name="" type="button" value="二次检索" class="butt4"/-->
            <input name="" type="button" value="清除" class="clear" onclick="clearData();"/>
		</div>
        
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="list">
          <tr> 
            <th width="25%">标题</th>
            <th width="15%">作者</th>
            <th width="10%">刊名</th>
            <th width="30%">英文主题词</th>
            <th width="10%">出版地</th>
            <th width="10%">出版日期</th>
          </tr>
          <%if(datalist != null && datalist.size()>0){ 
			    for(int i =0;i<datalist.size();i++){
			       Map obj = (Map)datalist.get(i);
			%>
			<tr>
 			<td  ><a href="javaScript:searchDetail(<%=obj.get("rid") %>);" ><%=obj.get("entitle")==null?"":obj.get("entitle") %></a></td>
			<td ><%=obj.get("author")==null?"":obj.get("author") %></td>
			<td  ><%=obj.get("periodicalname")==null?"":obj.get("periodicalname")  %></td>
			<td  style="word-break:break-all;"><%=obj.get("enthemewords")==null?"":obj.get("enthemewords")  %></td>
			<td  ><%=obj.get("publishcity")==null?"":obj.get("publishcity") %></td>
			<td ><%=obj.get("publishyear")==null?"":obj.get("publishyear")  %></td>
			</tr>
			<%}}else{ %>
			<%if(datalist.size()==0){ %>
			<td colspan="6" align=left>
			
			      <font size=6>找不到和您的查询 "<%=searchStr ==null?"":searchStr%>" 相符的内容或信息。
                                <br></br>
								建议：<br></br>
								
								•请检查输入字词有无错误。<br></br>
								•请尝试其他的查询词<br></br>
								•请改用较常见的字词。
								</font></td>
		   <%}else{ %>
		                <td colspan="6" align=left>
								</td>
		      
		   
		   <%} %>						
			
			 
          <%} %> 
         
        </table>
		</form>
        <div class="page">
        	<font size=4><%
 	PageInfo info = (PageInfo)request.getAttribute("pageinfo");
	int nums[] = info.getPageNumbers();// 页码数组
	int cp = info.getPageIndex();// 当前页
	int prePage = info.getPrePage();// 上页页码
	int nextPage = info.getNextPage();// 下页页码
	int totalPage = info.getTotalPage();// 总页数
	//out.println("总页数："+nums.length);
	//out.println("当前页："+cp);
	if(cp!=1){
%>	
	<a href="javaScript:nextpage('pagenum=<%=prePage%>&field=<%=field %>&language=<%=language==null?"":language %>','<%=searchStr%>');" class="next">上一页</a>
<%	
	}
	for(int i=0;i<nums.length;i++){
		if(nums[i]==cp){
%>
			<strong><%=nums[i]%></strong>
<%	
		}else{
%>
		<a href="javaScript:nextpage('pagenum=<%=nums[i]%>&field=<%=field %>&language=<%=language==null?"":language %>','<%=searchStr%>');"><%=nums[i]%></a>
<%		
		}
	}
	if(cp!=totalPage){
%>
	<a href="javaScript:nextpage('pagenum=<%=nextPage%>&field=<%=field %>&language=<%=language==null?"":language %>','<%=searchStr%>')" class="next">下一页</a>
<%
	}
%>&nbsp;</font>
</div> 
</div>
</body>
</html>
